// StandState.ts
import { ICharacterState } from './CharacterState';
import { PlayerController } from '../PlayerController';
import { CharacterState } from '../../enum';
import { Vec2 } from 'cc';

export class StandState implements ICharacterState {
    enter(controller: PlayerController) {
        controller.playerAnim.crossFade('idle', 0.2);
        // 添加方向保持逻辑（使用当前缩放值）
        controller.node.setScale(controller.node.scale.x, 1); 
    }

    update(controller: PlayerController, deltaTime: number) {
        const direction = controller.joystick.getDirection();
        if (!direction.equals(Vec2.ZERO)) {
            controller.transitionTo(CharacterState.RUN);
        }
    }

    exit(controller: PlayerController) {}
}